#include<iostream>
#include<cstdio>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>



using namespace std;


const string myenv = "hello aaaaaaaaaaaaaaaaaaaaaaaaa";
extern char** environ;



int main()
{
    putenv((char*)myenv.c_str);

    pid_t id = fork();
    if(id == 0)
    {
        char* const argv[] = {
            (char*)"other",
            nullptr 
        };

        char* const env[] = {
            (char*)"hello1",
            (char*)"hello2",
            (char*)"hello3",
            (char*)"hello4",
        };
        
         
        execvpe("./other",argv,environ);
        // execvpe("./other",argv,env);
        // sleep(3);
       // execlp("ls","ls","-l",nullptr);
        //execl("/bin/ls","ls","-l","--color","-a",nullptr);
        
        exit(1);
    }

    pid_t rid = waitpid(id,nullptr,0);
    if(rid>0)
    {
        printf("scuess\n");
    }

    return 0;
}



//int main()
//{
//    printf("i am myexec,pid:%d\n",getpid());
//    execl("./other","other",nullptr);
//    // execl("/bin/ls","ls","-l","-a",nullptr);
//
//    return 0;
//}
